package com.glsc.ngateway.platform.domain.softLegal;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * SoftLegalSerialNumber 实体类
 */
@Entity
@Data
@Table(name = "t_soft_change")
public class SoftChange {

    /**
     * 软件 ID，主键，自增
     */
    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    /**
     * 申请日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    @Column(name = "application_date", columnDefinition = "date DEFAULT NULL COMMENT '申请日期'")
    private LocalDate applicationDate; // 申请日期

    /**
     * 申请人
     */
    @Column(name = "applicant")
    private String applicant;

    /**
     * 申请人部门
     */
    @Column(name = "applicant_department")
    private String applicantDepartment;

    /**
     * 软件归口单位（原）
     */
    @Column(name = "original_software_focal_point_unit")
    private String originalSoftwareFocalPointUnit;

    /**
     * 软件归口单位（新）
     */
    @Column(name = "new_software_focal_point_unit")
    private String newSoftwareFocalPointUnit;

    /**
     * 升级方式
     */
    @Column(name = "upgrade_method")
    private String upgradeMethod;

    /**
     * 软件启用时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    @Column(name = "software_enable_time", columnDefinition = "date DEFAULT NULL COMMENT '软件启用时间'")
    private LocalDate softwareEnableTime;

    /**
     * 变更原因
     */
    @Column(name = "change_reason")
    private String changeReason;

    /**
     * 软件类型
     */
    @Column(name = "software_type")
    private String softwareType;

    /**
     * 软件类别
     */
    @Column(name = "software_category")
    private String softwareCategory;

    /**
     * 软件全称（其他）
     */
    @Column(name = "full_software_name")
    private String fullSoftwareName;

    /**
     * 软件厂商
     */
    @Column(name = "software_vendor")
    private String softwareVendor;

    /**
     * 软件版本
     */
    @Column(name = "software_version")
    private String softwareVersion;

    /**
     * 备注
     */
    @Column(name = "remarks")
    private String remarks;

    @ApiModelProperty(value = "创建时间")
    @Column(name = "insert_time", columnDefinition = "datetime comment '创建时间'")
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime insertTime;

    @ApiModelProperty(value = "更新时间")
    @Column(name = "update_time", columnDefinition = "datetime comment '更新时间'")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime updateTime;

    @Column(name = "is_delete", nullable = true, columnDefinition = "int DEFAULT '0' COMMENT '是否删除，0未删除，1 已删除'")
    private Integer isDelete;
}

